Options:
-h, --help Print this message
+ --aggressive Force updating all dependencies of <name> as well
--manifest-path PATH Path to the manifest to compile
-v, --verbose Use verbose output
`cargo build` or related commands.
If <name> is specified, then a conservative update of the lockfile will be
-performed. This means that only the dependency <name> (and all of its transitive
-dependencies) will be updated. All other dependencies will remain locked at
-their currently recorded versions.
+performed. This means that only the dependency <name> will be updated. Its
+transitive dependencies will be updated only if <name> cannot be updated without
+updating dependencies. All other dependencies will remain locked at their
+currently recorded versions.
If <name> is not specified, then all dependencies will be re-resolved and
updated.
shell.set_verbose(options.flag_verbose);
let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
- ops::update_lockfile(&root, shell, options.arg_name)
+ ops::update_lockfile(&root, shell, options.arg_name, options.flag_aggressive)
.map(|_| None).map_err(|err| CliError::from_boxed(err, 101))
}
pub fn update_lockfile(manifest_path: &Path,
shell: &mut MultiShell,
- to_update: Option<String>) -> CargoResult<()> {
+ to_update: Option<String>,
+ aggressive: bool) -> CargoResult<()> {
let mut source = try!(PathSource::for_path(&manifest_path.dir_path()));
try!(source.update());
let package = try!(source.get_root_package());
Some(name) => {
let mut to_avoid = HashSet::new();
for dep in resolve.iter().filter(|d| d.get_name() == name.as_slice()) {
- fill_with_deps(&resolve, dep, &mut to_avoid);
+ if aggressive {
+ fill_with_deps(&resolve, dep, &mut to_avoid);
+ } else {
+ to_avoid.insert(dep);
+ }
}
resolve.iter().filter(|pkgid| !to_avoid.contains(pkgid))
.map(|pkgid| pkgid.get_source_id().clone()).collect()
timer::sleep(Duration::milliseconds(1000));
assert_that(p.process(cargo_dir().join("cargo")).arg("update").arg("dep1"),
+ execs().with_stdout(""));
+ assert_that(p.process(cargo_dir().join("cargo")).arg("update").arg("dep1")
+ .arg("--aggressive"),
execs().with_stdout(format!("{} git repository `{}`",
UPDATING,
git_project.url())));